<?xml version="1.0" encoding="UTF-8" ?> 
<repository namespace="${ns}">
	
	<insert id="insert_dynamic">
		insert into ${tn}
		<trim prefix="(" suffix=")" suffixOverrides=",">
		<#list columns as column>
			<if test="${column.name} != null">${column.columnName},</if>
		</#list>
        </trim>
		<trim prefix=" values (" suffix=")" suffixOverrides=",">
		<#list columns as column>
			<if test="${column.name} != null">:${column.name},</if>
		</#list>
	    </trim>
	</insert>

	<update id="update_dynamic">
		update ${name}
		<set>
	        <trim suffixOverrides=",">		
			<#list columns as column>
			<#if !(column.isIdColumn??)>
				<if test="${column.name} != null">${column.name} = :${column.name},</if>
			</#if>
			</#list>
	        </trim>
		</set>
		<include refid="select_where_id"/>
    </update>

	<sql id="select_where_id">
		<where>
			<#if idColumn??>
			${idColumn.name} = :${idColumn.name}
			</#if>
		</where>
	</sql>
	
</repository>